<?php

namespace App\Modules\Apicrzs\Services\Pay;

use App\Modules\Admin\Entities\Mall\GoodsOrderModel;
use App\Modules\Admin\Entities\Water\WaterOrderModel;
use App\Modules\Apicrzs\Services\BaseServices;
use App\Modules\Apicrzs\Services\Water\WaterOrderService;

class StoreOrderSuccessServices extends BaseServices
{

    public function __construct(GoodsOrderModel $model)
    {
        $this->model = $model;
    }

    public function paySuccess(array $orderInfo, string $paytype = 'weixin', array $other = []){


        $update_order =[
            'pay_type'=>$paytype,
            'pay_time'=>time(),
            'status'=>1
        ];
        if ($other && isset($other['trade_no'])) {
            $updata['trade_no'] = $other['trade_no'];
        }
        /** @var WaterOrderModel $waterOrderModel */
        $waterOrderModel->updateWaterOrderByOrderId($orderInfo['order_id'],$update_order);
    }
}
